#include<stdio.h>
#include<string.h>
typedef struct candidate
{
    char name[50];
    int votes;
}candidate;


int main(void)
{
    candidate can1;
    candidate can2;
    candidate can3;
    candidate king;
    char vote[50];

    scanf("%s",can1.name);
    scanf("%s",can2.name);
    scanf("%s",can3.name);

    can1.votes = 0;
    can2.votes = 0;
    can3.votes = 0;

    while (scanf("%s",vote) != EOF)
    {
        setbuf(stdin,NULL);
        if (strcmp(can1.name,vote) == 0)
        {
            can1.votes++;
        }
        if (strcmp(can2.name,vote) == 0)
        {
            can2.votes++;
        }
        if (strcmp(can3.name,vote) == 0)
        {
            can3.votes++;
        }        
    }
    
    king = can2;
    if (can2.votes > can1.votes)
    {
        king = can2;
        if (king.votes < can3.votes)
        {
            king = can3;
        }
    }
    printf("%s",king.name);
    
}
